import Vue from 'vue'
import App from './App'
import store from './store'
import MinCache from'./common/util/MinCache.js'
import tip from'./common/util/tip.js'
import configService from'./common/service/config.service.js'

import router from './common/router'
import {RouterMount} from './plugin/uni-simple-router/index.js'

import Md5 from 'js-md5'
Vue.prototype.$md5 = Md5

// 注册缓存器
Vue.use(MinCache,{timeout: 6})

// store
Vue.prototype.$store=store;
// tip
Vue.prototype.$tip=tip;
// config
Vue.prototype.$config=configService;

// request请求
import { http } from '@/common/service/service.js' 
Vue.prototype.$http = http

//公共方法
import $public from './common/util/public.js' 
Vue.prototype.$public = $public


import gateway from './pages/gateway/gateway.vue'
Vue.component('gateway',gateway)

import notice from './pages/notice/notice.vue'
Vue.component('notice',notice)

import order from './pages/order/order.vue'
Vue.component('order',order)

import swiperTab from './pages/component/swiperTab.vue'
Vue.component('swiperTab',swiperTab)

import people from './pages/user/people.vue'
Vue.component('people',people)

// 自定义组件
import mySelect from './components/my-componets/my-select.vue'
Vue.component('mySelect',mySelect)

import getuser from './pages/getuser/getuser.vue'
Vue.component('getuser',getuser)

import myImageUpload from './components/my-componets/my-image-upload.vue'
Vue.component('myImageUpload',myImageUpload)

import myRadio from './components/my-componets/my-radio.vue'
Vue.component('myRadio',myRadio)


import myPage from './components/my-componets/my-page.vue'
Vue.component('myPage',myPage)



import cuCustom from './plugin/colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)

//空数据模板
import empty from './pages/component/empty.vue'
Vue.component('empty',empty)

//请求加载组件
import requestLoading from './pages/component/requestLoading.vue';
//组件挂载到全局，方便每个页面使用
Vue.component('request-loading', requestLoading);

//挂载全局显示/隐藏请求加载动画
function showLoading(){
	store.commit('request_show_loading');
}
function hideLoading(){
	store.commit('request_hide_loading');
}
Vue.prototype.$showLoading = showLoading; //全局显示动画可以 this.$showLoading();
Vue.prototype.$hideLoading = hideLoading; //全局隐藏动画可以 this.$hideLoading();

//图片拼接地址
function getFileAccessHttpUrl(avatar,subStr){
	    if(!subStr) subStr = 'http'
	    if(avatar && avatar.startsWith(subStr)){
	        return avatar;
	    }else{
	        return configService.staticDomainURL + "/" + avatar;
	    }
}
Vue.prototype.$getFileAccessHttpUrl = getFileAccessHttpUrl;
// import VConsole from './js_sdk/vconsole.min'

//   var vConsole = new VConsole();

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
	store,
	MinCache,
    ...App
})
//v1.3.5起 H5端 你应该去除原有的app.$mount();使用路由自带的渲染方式
// #ifdef H5
	RouterMount(app,'#app');
// #endif

// #ifndef H5
	app.$mount(); //为了兼容小程序及app端必须这样写才有效果
// #endif



 



